package com.neo.task;

import com.neo.utils.O2OJSON;
import org.springframework.stereotype.Service;

import java.util.Random;

/**
 * Created by yanhao on 2017/12/12.
 */
@Service
public class SentMessage {



    private void  sentMessage(){

        try {


            O2OJSON json = new O2OJSON();

            String phone = getRandomPhone();

            final String url = "https://m.yaoqianhua.com/yaoqianhua-gateway/authenticationService/getSMSCode";
            json.put("phone",phone);
            json.put("sourceType",0);
            json.put("type","register");
            json.put("verification","");
            json.put("smsCode","");
            json.put("token","");


           // O2OJSON result = HttpRequestUtils.doPost(url, JSONObject.toJSONString(json), O2OJSON.class);
        } catch (Exception e) {
            e.printStackTrace();
        }


    }




    private static String getRandomPhone() {
        String[] num = {"13","15","18","17"};
        Random random = new Random();
        int nums = random.nextInt(num.length);
        String phs = num[nums];
        Double randoms = Math.random();
        return (phs+randoms.toString().substring(2, 11));
    }

}
